﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace blackhouse.Web.Controls {
	public enum DynamicImageType {

		File,
		Database

	}

	internal static class DynamicImageTypeOpe {

		private static Dictionary<DynamicImageType, string> shortNames;
		private static Dictionary<DynamicImageType, string> ShortNames {
			get {
				if (shortNames == null) {
					Dictionary<DynamicImageType, string> d = new Dictionary<DynamicImageType, string>();
					d.Add(DynamicImageType.File, "fbdi");
					d.Add(DynamicImageType.Database, "dbdi");
					shortNames = d;
				}
				return shortNames;
			}
		}

		private static Dictionary<DynamicImageType, string> fullNames;
		private static Dictionary<DynamicImageType, string> FullNames {
			get {
				if (fullNames == null) {
					Dictionary<DynamicImageType, string> d = new Dictionary<DynamicImageType, string>();
					d.Add(DynamicImageType.File, "DynamicImageFileBased");
					d.Add(DynamicImageType.Database, "DbDynamicImage");
					fullNames = d;
				}
				return fullNames;
			}

		}

		internal static string GetFullName(DynamicImageType type) {
			return GetName(FullNames, type);
		}

		internal static string GetShortName(DynamicImageType type) {
			return GetName(ShortNames, type);
		}

		private static string GetName(Dictionary<DynamicImageType, string> col, DynamicImageType dit) {
			if (col.ContainsKey(dit))
				return col[dit];
			else return dit.ToString();
		}

	}

}